
<!--- <cfparam name="resetFilters" default="false">
<cfset isFiltered = false />
<cfset queryParams = StructNew() />

<cfwddx action="cfml2wddx" input="#queryParams#" output="client.products.queryParamsWDDX" />

<cfscript>
	products = request.productGateway.query(argumentCollection = queryParams);
</cfscript>

<cfdirectory name="images" action="list" directory="#ExpandPath('/csac/common/images/products/')#" type="file" />
<cfdirectory name="files" action="list" directory="#ExpandPath('/csac/common/files/products/')#" type="file" />

<cfoutput>

	<h1>Products<cfif isFiltered> <small><em>filtered</em></small></cfif></h1>
	
	<div class="row" style="margin-bottom: 10px;">
		<div class="col-lg-12">
			<a href="#script_name#?ui=editProduct&Product_ID=0" class="btn btn-info">New&nbsp;product</a>
			<!--- <a id="filterLink" href="##" class="btn btn-info" onclick="toggleFilter('filter')">Show filters</a> --->
			<div class="btn-group">
				<button class="btn btn-info dropdown-toggle" data-toggle="dropdown">Actions</button>
				<button class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
				<ul class="dropdown-menu">
					<li><a href="?action=export&collection=products" target="_new">Export</a></li>
				</ul>
			</div>
			<span class="pull-right"><strong>Count:</strong> #products.RecordCount#</span>
		</div>
	</div>

	<cfform name="productsForm" id="productsForm" action="#script_name#" method="post">
		<cfinput type="hidden" name="ui" value="#ui#">
		
		<cfif products.RecordCount gt 0>

			<table class="table table-striped table-bordered table-hover">
				<thead>
					<th>ID</th>
					<th>SKU</th>
					<th>Category</th>
					<th>Product</th>
					<th>Image</th>
					<th>File</th>
					<th>In Stock</th>
					<th>Stock Warning</th>
					<th>Allow Backorder</th>
					<th>Total Ordered</th>
					<th>Total Shipped</th>
				</thead>
				<tbody>
					<cfloop query="products">
						<cfquery name="productImages" dbtype="query">
							select *
							from images
							where name like '%#Product_ID#.%'
						</cfquery>
						<cfquery name="productFiles" dbtype="query">
							select *
							from files
							where name like '%#Product_ID#.%'
						</cfquery>
						<tr>
							<td><a href="?ui=editProduct&Product_ID=#Product_ID#">#Product_ID#</a></td>
							<td>#ID#</td>
							<td>#Category#</td>
							<td>#Product#</td>
							<td>
								<cfif productImages.RecordCount gt 0>
									<a href="##" target="_blank"><span class="icon-picture icon-large"></span></a>
								</cfif>
							</td>
							<td>
								<cfif productFiles.RecordCount gt 0>
									<a href="##" target="_blank"><span class="icon-download-alt icon-large"></span></a>
								</cfif>
							</td>
							<td>#Stock#</td>
							<td>#Stock_Warn#</td>
							<td>#YesNoFormat(Allow_Back_Order)#</td>
							<td>
								<cfif IsNumeric(Quantity_Ordered)>
									#Quantity_Ordered#
								<cfelse>
									0
								</cfif>
							</td>
							<td>
							<cfif IsNumeric(Quantity_Shipped)>
									#Quantity_Shipped#
								<cfelse>
									0
								</cfif>
							</td>
						</tr>
					</cfloop>
				</tbody>
			</table>
			
			<script type="text/javascript">
				$(function() {
					$("##productsList").kendoGrid({
						sortable: {
							mode: "single",
							allowUnsort: false
						}			
					})
					$("##productsList").show();
				})
			</script>
			
		<cfelse>
		
			<div class="alert alert-info">No products</div>
			
		</cfif>

	</cfform>

</cfoutput> --->